<?php
/**
 * Created by PhpStorm.
 * User: liyu
 * Date: 2018/12/4
 * Time: 2:34 PM
 */

$db = new PDO('mysql:dbname=test;host=127.0.0.1','root','uxuanlife2016!@#');
$fh = fopen(__DIR__ . '/schema.sql', 'r');
while (!feof($fh)) {
    $line = fgets($fh);
    echo $line.PHP_EOL;
    var_dump($db->exec($line));
}
echo '导入成功';
fclose($fh);